//
//  TravelDetialViewController.m
//  Haliaeetus
//
//  Created by junli hou on 2018/3/30.
//  Copyright © 2018年 BMY. All rights reserved.
//

#import "TravelDetialViewController.h"

@interface TravelDetialViewController ()

@end

@implementation TravelDetialViewController
- (void)loadView {
    [super loadView];
    self.title =@"行程详情";
    self.view.backgroundColor = [UIColor whiteColor];
    self.edgesForExtendedLayout = UIRectEdgeNone;
    [self.navigationController setLeftBtnWithTarget:self action:@selector(goBack)];
    [self initView];
    
}
- (void)goBack {
    [self.navigationController popViewControllerAnimated:YES];
    
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
}
- (void)initView{
    
    UIImageView *hotelImageView = [[UIImageView alloc]init];
    hotelImageView.image=[UIImage imageNamed:@"hotel_icon"];
    hotelImageView.frame = CGRectMake(33,26,16,16);
    [self.view addSubview:hotelImageView];
    
    UIImageView *locationImageView = [[UIImageView alloc]init];
    locationImageView.image=[UIImage imageNamed:@"location_icon"];
    locationImageView.frame = CGRectMake(33,32+CGRectGetMaxY(hotelImageView.frame),16,16);
    [self.view addSubview:locationImageView];
    

    UIImageView *dateImageView = [[UIImageView alloc]init];
    dateImageView.image=[UIImage imageNamed:@"bad_icon"];
    dateImageView.frame = CGRectMake(177,133,20,20);
    [self.view addSubview:dateImageView];
    
    UILabel *spaceName = [[UILabel alloc]init];
    spaceName.frame = CGRectMake(56,20,WS_SCREEN_FRAME_WIDTH-112,30);
    spaceName.font = [UIFont systemFontOfSize:14];
    
    spaceName.textColor = WS_RGB(68, 69, 60);
    spaceName.text=[NSString stringWithFormat:@"%@,%@",WS_STR_NOT_NULL([self.dic objectForKey:@"place_name"]),@""];;
    [self.view addSubview:spaceName];
    
    UILabel *cityName = [[UILabel alloc]init];
    cityName.frame = CGRectMake(56,63,WS_SCREEN_FRAME_WIDTH-112,40);
    cityName.font = [UIFont systemFontOfSize:14];
    cityName.numberOfLines=2;
    cityName.textColor = WS_RGB(68, 69, 60);
    cityName.text=[NSString stringWithFormat:@"%@,%@",WS_STR_NOT_NULL([self.dic objectForKey:@"country"]),WS_STR_NOT_NULL([self.dic objectForKey:@"city_name"])];
    [self.view addSubview:cityName];
    

    
    UILabel *checkInDate = [[UILabel alloc]init];
    checkInDate.frame = CGRectMake(33,130,135,28);
    checkInDate.font = [UIFont systemFontOfSize:20];
    checkInDate.textAlignment=NSTextAlignmentLeft;
    checkInDate.textColor = WS_RGB(255, 134, 35);
    checkInDate.text=[NSString stringWithFormat:@"%@",WS_STR_NOT_NULL([self.dic objectForKey:@"check_in_date"])];
    [self.view addSubview:checkInDate];
    
    UILabel *checkoOutDate = [[UILabel alloc]init];
    checkoOutDate.frame = CGRectMake(WS_SCREEN_FRAME_WIDTH-33-135,130,135,28);
    checkoOutDate.font = [UIFont systemFontOfSize:20];
    checkoOutDate.textAlignment=NSTextAlignmentRight;
    checkoOutDate.textColor = WS_RGB(255, 134, 35);
    checkoOutDate.text=[NSString stringWithFormat:@"%@",WS_STR_NOT_NULL([self.dic objectForKey:@"check_out_date"])];
    [self.view addSubview:checkoOutDate];
    
    
    UILabel *daysTitle = [[UILabel alloc]init];
    daysTitle.frame = CGRectMake(33,22+CGRectGetMaxY(checkoOutDate.frame),WS_SCREEN_FRAME_WIDTH-112,20);
    daysTitle.font = [UIFont systemFontOfSize:12];
    daysTitle.numberOfLines=1;
    daysTitle.textColor = WS_RGB(68, 69, 60);
    daysTitle.text=@"房间数";
    [self.view addSubview:daysTitle];
    UILabel *daysLabel = [[UILabel alloc]init];
    daysLabel.frame = CGRectMake(33,5+CGRectGetMaxY(daysTitle.frame),WS_SCREEN_FRAME_WIDTH-112,20);
    daysLabel.font = [UIFont systemFontOfSize:12];
    daysLabel.numberOfLines=1;
    daysLabel.textColor = WS_RGB(68, 69, 60);
    daysLabel.text=[NSString stringWithFormat:@"%@",WS_STR_NOT_NULL([self.dic objectForKey:@"rooms"])];
    [self.view addSubview:daysLabel];
    
    UILabel *orderNumberTitle = [[UILabel alloc]init];
    orderNumberTitle.frame = CGRectMake(33,22+CGRectGetMaxY(daysLabel.frame),WS_SCREEN_FRAME_WIDTH-112,20);
    orderNumberTitle.font = [UIFont systemFontOfSize:12];
    orderNumberTitle.numberOfLines=1;
    orderNumberTitle.textColor = WS_RGB(68, 69, 60);
    orderNumberTitle.text=@"确认号码";
    [self.view addSubview:orderNumberTitle];
    UILabel *orderNumberLabel = [[UILabel alloc]init];
    orderNumberLabel.frame = CGRectMake(33,5+CGRectGetMaxY(orderNumberTitle.frame),WS_SCREEN_FRAME_WIDTH-112,20);
    orderNumberLabel.font = [UIFont systemFontOfSize:15];
    orderNumberLabel.numberOfLines=1;
    orderNumberLabel.textColor =  WS_RGB(255, 134, 35);
    orderNumberLabel.text=WS_STR_NOT_NULL([self.dic objectForKey:@"confirmation_number"]);
    [self.view addSubview:orderNumberLabel];
    
    
    UILabel *phoneTitle = [[UILabel alloc]init];
    phoneTitle.frame = CGRectMake(33,22+CGRectGetMaxY(orderNumberLabel.frame),WS_SCREEN_FRAME_WIDTH-112,20);
    phoneTitle.font = [UIFont systemFontOfSize:12];
    phoneTitle.numberOfLines=1;
    phoneTitle.textColor = WS_RGB(68, 69, 60);;
    phoneTitle.text=@"酒店地址&电话号码";
    [self.view addSubview:phoneTitle];
    UILabel *phoneLabel = [[UILabel alloc]init];
    phoneLabel.frame = CGRectMake(33,5+CGRectGetMaxY(phoneTitle.frame),WS_SCREEN_FRAME_WIDTH-112,80);
    phoneLabel.font = [UIFont systemFontOfSize:14];
    phoneLabel.numberOfLines=5;
    phoneLabel.textColor = WS_RGB(68, 69, 60);
    
    [self.view addSubview:phoneLabel];
    
    NSString *addressJson=WS_STR_NOT_NULL([self.dic objectForKey:@"extra"]);
    NSData *jsonData = [addressJson dataUsingEncoding:NSUTF8StringEncoding];
    NSError *err;
    NSArray *array = [NSJSONSerialization JSONObjectWithData:jsonData
                                                        options:NSJSONReadingMutableContainers
                                                          error:&err];
    NSMutableString *addressString = [[NSMutableString alloc]init];;
    for ( NSString *address in array) {
        [addressString appendString:[NSString stringWithFormat:@"%@\n",address]];
    }
    phoneLabel.text=addressString;

    
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
